package trivera.core.strings;

import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * <p>
 * This component and its source code representation are copyright protected
 * and proprietary to The Trivera Group, Inc., Worldwide D/B/A Trivera Technologies
 *
 * This component and source code may be used for instructional and
 * evaluation purposes only. No part of this component or its source code
 * may be sold, transferred, or publicly posted, nor may it be used in a
 * commercial or production environment, without the express written consent
 * of the Trivera Group, Inc.
 *
 * Copyright c 2013 The Trivera Group, LLC.
 * http://www.triveratech.com   http://www.triveragroup.com
 * </p>
 * @author The Trivera Group Tech Team.
 */

public class StringParsing {

    public static void main(String[] args) {

        // Create a sentence as a String
        String sentence = "And in this harsh world draw thy breath in pain, to tell my story.";

        // Create a StringTokenizer, initialized with the string
        StringTokenizer tok = new StringTokenizer(sentence);
        Scanner scanner = new Scanner(sentence);
        scanner.useDelimiter(",");
        System.out.println ("scanner 1: " + scanner.next());
        System.out.println("scanner 2: " + scanner.next());
        
        
        // Loop through the tokenizer, for every time there is another token...
        while (tok.hasMoreTokens()) {

            // Get the next token
            String tokStr = tok.nextToken();

            // Print the token
            System.out.println(tokStr);
        }

        // verify the version of Java that is running
        System.out.println(System.getProperty("java.version"));

    }
}
